class MyThreadLocalExample {
    private static ThreadLocal<Integer> threadLocal = new ThreadLocal<>();

    public static void main(String[] args) {
        int value = getValue(2);
        System.out.println(value);

        double a=10;
        Object o = new Object();
     
//        try {
//            // 设置线程局部变量的值
//            threadLocal.set(123);
//
//            // 执行业务逻辑...
//        } finally {
//            // 清理线程局部变量
//            threadLocal.remove();
//        }
    }
    public static int getValue(int i) {
        int result = 0;
        switch (i) {
            case 1:
                result = result + i;
            case 2:
                result = result + i * 2;
            case 3:
                result = result + i * 3;
        }
        return result;
    }
}



